package cn.gok.entity;

import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Pattern;

public class Student {
    private Integer id;

    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{2,10}",message = "昵称必须是2~10个汉字")
    private String studentName;
    @Pattern(regexp = "\\w{6,20}",message = "密码必须有6~20位之间的字母，数字，下滑线组成")
    private String password;
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,6}",message = "昵称必须是1~6个汉字")
    private String realName;
    @Range(min=1,max=100,message="年龄必须在1~100岁之间")
    private Integer age;

    private String gender;

    public Student(Integer id, String studentName, String password, String realName, Integer age, String gender) {
        this.id = id;
        this.studentName = studentName;
        this.password = password;
        this.realName = realName;
        this.age = age;
        this.gender = gender;
    }

    public Student() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName == null ? null : studentName.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName == null ? null : realName.trim();
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender == null ? null : gender.trim();
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", studentName='" + studentName + '\'' +
                ", password='" + password + '\'' +
                ", realName='" + realName + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                '}';
    }
}